<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
	</head>
	<body>
		<div id="div2">
			<img src="img/1.jpg" id="tupian" height="200px" width="200px">
		</div>
		<select name="" id="xuanze">
			<option value="请选择" >请选择</option>
			<option value="大" >大</option>
			<option value="小" >小</option>
		</select>
		<button type="button" onclick="kaishi()">开始</button>
	</body>
	<script type="text/javascript">
		function kaishi(){
			var arr=["img/1.jpg","img/2.jpg","img/3.jpg","img/4.jpg","img/5.jpg","img/6.jpg"];
			// console.log(b)
			var c=0;
			var myInterval = setInterval(function(){
				var b=xunhuan();
					var xuanz = document.getElementById('xuanze')
					if(xuanz.value=='请选择'){
						alert('猜拳');
						location.reload();
					}
				if(c==10){
					//清除定时器
					
					if(xuanz.value =='大' && b>3){
						alert('恭喜答对了')
					}else if(xuanz.value =='大' && b<4){
						alert('答错了')
					}
					if(xuanz.value=='小' && b<4){
						alert('恭喜你答对了')
					}else if(xuanz.value=='小' && b>3){
						alert('答错了')
					}
					clearInterval(myInterval);
				}
					document.getElementById('tupian').setAttribute('src',arr[b])
					console.log(arr[b])
					c++;
					
			},100)
			
		}
		function xunhuan(){
			var a=0;
			 a=Math.floor(Math.random()*6);
			return a;
		}
	</script>
</html>
